export default class recorder{
  constructor(){
    this.ctx = wx.getRecorderManager()
    this.ctx.onStop(this.collect.bind(this))
  }
  collect(res){
    this.path = res.tempFilePath
  }
  start(){
    this.ctx.start()
  }
  stop(){
    this.ctx.stop()
  }
  resume(){
    this.ctx.resume()
  }
  pause(){
    this.ctx.stop()
  }
  getFilePath(){
    return this.path
  }
  setCallback(event,cb){
    this.ctx[event](cb)
  }
}